package com.springcloud.config.ribbon;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import com.springcloud.annotation.ExcludComponentScanClass;

/**
 * 定制user ribbon规则 
 * 定制优先级：配置文件>java代码>默认配置
 * @author Pakho
 */
@Configuration
@ExcludComponentScanClass
public class UserRibbonConfig {

	/* 负载均衡策略，多种，详情请查看源码 */
	@Bean
	public IRule ribbonRule() {
		// BestAvailableRule 选择并发最少的
		// RoundRobinRule 轮询
		return new RandomRule();// 随机策略
	}
}
